<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">
	
<h:head>

  
</h:head>

<h:body>
<script type="text/javascript">
function 	rform()
{
	document.insertProjectForm.reset();
}
</script>


<p:tabView id="tabView">
	<p:tab  title="Pojects">
		<p:tabView id="projects">
       		<p:tab id="insert" title="Insert">
				<h:form  id="form"  style="height: 500px; ">
					Insert new Project
						<p:panelGrid border="2" columns="2" style="height: 200px; width: 383px; ">
							<h:outputText value="project name"></h:outputText>
							<p:inputText id ="projectName" value="#{ProjectEntityHandlerBean.projectName}" required="true" requiredMessage="Please enter the project name."></p:inputText>
							<h:outputText value="project description"></h:outputText>
							<p:inputText id="projectDescription" value="#{ProjectEntityHandlerBean.description}" required="true" requiredMessage="Please enter the project description."></p:inputText>
							<h:outputText value="project duration (Months)" required="true" requiredMessage="Please enter the project duration."></h:outputText>
							<p:inputText id="projectDuration" value="#{ProjectEntityHandlerBean.duration}" required="true" requiredMessage="Please enter the project duration."></p:inputText>
						</p:panelGrid>
						<p:message for="projectName" />
						<p:message for="projectDescription" />
						<p:message for="projectDuration" />
						<p:commandButton value="Submit" action="#{ProjectEntityHandlerBean.insertNewProject()}" ajax="true" process="form"  update="form" ></p:commandButton> 
				</h:form>      	
       		</p:tab>

       		<p:tab  title="Delete">
       			<h:form id="deleteForm" style="height: 500px; ">
					Delete Project
						<p:panelGrid id="panel" border="2" columns="2" style="height: 50px; width: 383px; ">
							<h:outputText  value="project name"></h:outputText>
							<p:inputText id="proje" value="#{ProjectEntityHandlerBean.projectName}" required="true" requiredMessage="Please enter the project name."></p:inputText>							
						</p:panelGrid>	
						<p:message for="proje" />		
						<p:commandButton value="Delete" action="#{ProjectEntityHandlerBean.delete()}" update="deleteForm"></p:commandButton>
				</h:form>  
       		</p:tab>
 
 
	       	<p:tab  title="Read">	
	       		<h:form id="readForm">      
	       			Get all Projects  			       	 	  
	    			<p:dataTable id="table" var="project" value="#{ProjectEntityHandlerBean.projectList}">  
	       				<p:column headerText="Project Name">  
	            			<h:outputText value="#{project.projectName}" />  
	        			</p:column>      
	       				<p:column headerText="Project Description">  
	            			<h:outputText value="#{project.description}" />  
	        			</p:column>
	       				<p:column headerText="Project Duration (Months)">  
	            			<h:outputText value="#{project.duration}" />  
	        			</p:column>       			   
	        		</p:dataTable>	        		   			  				    
				  	<p:commandButton value="Get all Projects"  action="#{ProjectEntityHandlerBean.getAllProjects()}" update="readForm"  ></p:commandButton>
				</h:form>      	  	
	       	</p:tab>          	
       	</p:tabView> 
  
	</p:tab>      
  
    <p:tab  title="Departments">
		<p:tabView>
       		<p:tab title="Insert">
				<h:form id="departmentForm" style="height: 500px; ">
					Insert new Project
						<p:panelGrid border="2" columns="2" style="height: 200px; width: 383px; ">
							<h:outputText value="Department name"></h:outputText>
							<p:inputText id="departmentname" value="#{departmentEntityHandlerBean.departmentName}" required="true" requiredMessage="Please enter the department name."></p:inputText>
							<h:outputText value="City"></h:outputText>
							<p:inputText id="departmentCity" value="#{departmentEntityHandlerBean.departmentCity}" required="true" requiredMessage="Please enter the department city."></p:inputText>
							<h:outputText value="Phone number"></h:outputText>
							<p:inputText id="departmentPhoneNumber" value="#{departmentEntityHandlerBean.departmentPhoneNumber}" required="true" requiredMessage="Please enter the department  phone number."></p:inputText>
						</p:panelGrid>
					 	<p:message for="departmentname"/>
					 	<p:message for="departmentCity"/> 
					 	<p:message for="departmentPhoneNumber"/>   
						<p:commandButton value="Submit" action="#{departmentEntityHandlerBean.insertNewDepartment()}" ajax="true" process="departmentForm"  update="departmentForm"></p:commandButton>
				</h:form>      	
       		</p:tab>
	       	<p:tab  title="Delete">
	       		<h:form id="deleteForm" style="height: 500px; ">
					Delete Department
						<p:panelGrid  border="2" columns="2" style="height: 50px; width: 383px; ">
							<h:outputText  value="department name"></h:outputText>
							<p:inputText id="departmentname" value="#{departmentEntityHandlerBean.departmentName}" required="true" requiredMessage="Please enter the department name."></p:inputText>							
						</p:panelGrid>
						<p:message for="departmentname"/> 
						<p:commandButton value="Delete" action="#{departmentEntityHandlerBean.delete()}"  update="deleteForm"></p:commandButton>
				</h:form>
	       	</p:tab>
       		
	       	<p:tab  title="Read">
	       		<h:form>       			       	 	  
	    			<p:dataTable id="table" var="department" value="#{departmentEntityHandlerBean.departmentList}">
    
	       				<p:column headerText="Department name">  
	            			<h:outputText value="#{department.name}" />  
	        			</p:column>      
	       				<p:column headerText="City">  
	            			<h:outputText value="#{department.city}" />  
	        			</p:column>
	       				<p:column headerText="Phone number">  
	            			<h:outputText value="#{department.phoneNumber}" />  
	        			</p:column>       			   
	        		</p:dataTable>	        		   			  				    
				  	<p:commandButton value="Get all Projects"  action="#{departmentEntityHandlerBean.getAllDepartments()}" update="table" ></p:commandButton>
				</h:form>        	
	       	</p:tab>
       </p:tabView> 
  
	</p:tab>
    
    <p:tab  title="Employees">
		<p:tabView>
       		<p:tab title="Insert">
       			<h:form id="employeeForm" style="height: 500px; ">
					Insert new Employee
						<p:panelGrid border="2" columns="2" style="height: 200px; width: 383px; ">
							<h:outputText value="First name"></h:outputText>
							<p:inputText id="employeeFirstName" value="#{employeeEntityHandlerBean.employeeFirstName}" required="true" requiredMessage="Please enter the employee`s first name."></p:inputText>
							<h:outputText value="Last name"></h:outputText>
							<p:inputText id="employeeLastName" value="#{employeeEntityHandlerBean.employeeLastName}" required="true" requiredMessage="Please enter the employee`s last name."></p:inputText>
							<h:outputText value="Phone number"></h:outputText>
							<p:inputText id="employeePhoneNumber" value="#{employeeEntityHandlerBean.employeePhoneNumber}" required="true" requiredMessage="Please enter the employee`s phone number."></p:inputText>
						</p:panelGrid>
						<p:message for="employeeFirstName"/>
						<p:message for="employeeLastName"/>
						<p:message for="employeePhoneNumber"/>
						<p:commandButton value="Submit" action="#{employeeEntityHandlerBean.insertNewEmployee()}" update="employeeForm"></p:commandButton>
				</h:form>       	
       		</p:tab>
       		<p:tab  title="Delete">
       			<h:form id="deleteForm" style="height: 500px; ">
					Delete Employee
						<p:panelGrid id="panel" border="2" columns="2" style="height: 50px; width: 500px; ">
							<h:outputText value="Employee last name"></h:outputText>
							<p:inputText id="employeeLastName" value="#{employeeEntityHandlerBean.employeeLastName}" required="true" requiredMessage="Please enter the employee`s last name."></p:inputText>							
						</p:panelGrid>
						<p:message for="employeeLastName"/>
						<p:commandButton value="Delete" action="#{employeeEntityHandlerBean.delete()}" update="deleteForm"></p:commandButton>
				</h:form>
       		</p:tab>      	
	       	<p:tab  title="Read">
	       		<h:form>       			       	 	  
	    			<p:dataTable id="table" var="employee" value="#{employeeEntityHandlerBean.employeeList}">  
	       				<p:column headerText="First Name">  
	            			<h:outputText value="#{employee.firstName}" />  
	        			</p:column>      
	       				<p:column headerText="Last Name">  
	            			<h:outputText value="#{employee.lastName}" />  
	        			</p:column>
	       				<p:column headerText="Phone number">  
	            			<h:outputText value="#{employee.phoneNumber}" />  
	        			</p:column>       			   
	        		</p:dataTable>	        		   			  				    
				  	<p:commandButton value="Get all Projects"  action="#{employeeEntityHandlerBean.getAllEmployees()}" update="table" ></p:commandButton>
				</h:form>   
	       	</p:tab>     	
       </p:tabView>  
	</p:tab>      
     <p:tab  title="Partners">
		<p:tabView>
       		<p:tab title="Insert">
       			<h:form id="partnerForm" style="height: 500px; ">
					Insert new Partner
						<p:panelGrid border="2" columns="2" style="height: 200px; width: 383px; ">
							<h:outputText value="Name"></h:outputText>
							<p:inputText id="partnerName" value="#{partnerEntityHandlerBean.partnerName}" required="true" requiredMessage="Please enter the partner name."></p:inputText>
							<h:outputText value="City"></h:outputText>
							<p:inputText id="partnerCity" value="#{partnerEntityHandlerBean.partnerCity}" required="true" requiredMessage="Please enter the partner city."></p:inputText>
							<h:outputText value="Contact E-mail"></h:outputText>
							<p:inputText id="partnerContactMail" value="#{partnerEntityHandlerBean.partnerContactMail}" required="true" requiredMessage="Please enter the partner contact e-mail."></p:inputText>
						</p:panelGrid>
						<p:message for="partnerName"/>
						<p:message for="partnerCity"/>
						<p:message for="partnerContactMail"/>
						<p:commandButton value="Submit" action="#{partnerEntityHandlerBean.insertNewPartner()}" update="partnerForm"></p:commandButton>
				</h:form>      	
       		</p:tab>
       	<p:tab  title="Delete">
       		<h:form id="deleteForm" style="height: 500px; ">
				Delete Partner
					<p:panelGrid id="panel" border="2" columns="2" style="height: 50px; width: 500px; ">
						<h:outputText value="Partner name"></h:outputText>
						<p:inputText id="partnerName" value="#{partnerEntityHandlerBean.partnerName}"  required="true" requiredMessage="Please enter the partner name."></p:inputText>							
					</p:panelGrid>
					<p:message for="partnerName"/>
					<p:commandButton value="Delete" action="#{partnerEntityHandlerBean.delete()}" update="deleteForm"></p:commandButton>
			</h:form>
       	</p:tab>
       		
       	<p:tab  title="Read">
       		<h:form>       			       	 	  
    			<p:dataTable id="table" var="partner" value="#{partnerEntityHandlerBean.partnerList}">  
       				<p:column headerText="Partner Name">  
            			<h:outputText value="#{partner.name}" />  
        			</p:column>      
       				<p:column headerText="City">  
            			<h:outputText value="#{partner.city}" />  
        			</p:column>
       				<p:column headerText="Contact Mail">  
            			<h:outputText value="#{partner.contactMail}" />  
        			</p:column>       			   
        		</p:dataTable>	        		   			  				    
			  	<p:commandButton value="Get all Projects"  action="#{partnerEntityHandlerBean.getAllPartners()}" update="table" ></p:commandButton>
			</h:form>
       	</p:tab>
       	
       	
       </p:tabView> 
  
	</p:tab>  
</p:tabView>  


</h:body>



</html>
